package com.quectel.sdk.dahua9100;

import cn.hutool.core.date.DateUtil;
import com.quectel.sdk.dahua9100.monitor.MonitorClient;

import java.util.Arrays;
import java.util.Date;

/**
 * 在这里编写说明
 *
 * @author: rananxin
 * @email: ryan.ran@quectel.com
 * @date: 2022-11-08 13:30:00
 */
public class Dahua9100Test {

    public static void main(String[] args) throws Exception {
        MonitorClient build = Dahua9100ClientBuilder.builder().username("yiyuan").password("yiyuan123").ip("18.18.0.1").build(MonitorClient.class);
//        List<String> list = build.previewDefaultUrl(Arrays.asList("xr7TW0sSA1BJ202HIDHOJR"));
//        System.out.println(JacksonUtils.toJsonString(list));

//        List<DeviceResp.ResultsCls> resultsCls =
//                build.drawResources();
//        System.out.println(JacksonUtils.toJsonString(resultsCls));


        build.fetchFaceRecord(Arrays.asList("xr7TW0sSA1BJ202HC73OON", "xr7TW0sSA1BJ202HAMEMHV")
                , DateUtil.offsetDay(new Date(), -10), new Date(), System.out::println);


//        String msgId = null;
//        for (int i = 0; i < 50; i++) {
//            Thread.sleep(3000);
//            Pair<String, List<EventFaceData>> stringListPair1 = build.fetchFaceEvent(msgId);
//            msgId = stringListPair1.getLeft();
//
//            System.out.println(JacksonUtils.toJsonString(stringListPair1));
//        }

//        Dahua9100Requester instance = Dahua9100Requester.getInstance("yiyuan", "yiyuan123", "18.18.0.1");
//
//        HashMap<String, Object> hashMap = new HashMap<String, Object>() {{
//            put("channelCode", "32ad640bc4974227a783ea3145ff7f0a");
//            put("beginTime", DateUtils.format(DateUtil.offsetMonth(new Date(), -1), DateUtils.FormatType.TZ));
//            put("endTime", DateUtils.format(new Date(), DateUtils.FormatType.TZ));
//            put("location", "cloud");
//        }};
//        String content = "?channelCode=32ad640bc4974227a783ea3145ff7f0a" +
//                "&beginTime=20191019T001020Z" +
//                "&endTime=20221019T233020Z" +
//                "&location=cloud";
//
//        String resp1 = instance.get("/videoService/record/records" + content, new HashMap<>());
//        System.out.println(resp1);
//
//        String resp2 = instance.get("/videoService/playback/uri", new HashMap<String, Object>() {{
//            put("channelCode", "32ad640bc4974227a783ea3145ff7f0a");
//            put("beginTime", DateUtils.format(DateUtil.offsetMonth(new Date(), -1), DateUtils.FormatType.TZ));
//            put("endTime", DateUtils.format(new Date(), DateUtils.FormatType.TZ));
//            put("location", "cloud");
//            put("scheme", "HLS");
//        }});
//        System.out.println(resp2);
    }
}
